<template>
	<view>
		<cu-custom bgColor="bg-theme" :isBack="false"></cu-custom>
		<view class="bg-theme cu-card padding " style="min-height: 300rpx;">
			<view class="flex padding align-center justify-center" style="width: 100%; height: 100%;">
				<text class="cuIcon-roundcheck margin-right-xs text-white" style="font-size: 50rpx;"></text>
				<text class="text-ABC text-white" style="font-weight: 600;font-size: 46upx; font-family:'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif">支付成功</text>
			</view>
			<view class="flex justify-around" style="margin: 0 86rpx;">
				<button class="cu-btn round lines-white" @tap="goToOrder">查看订单</button>
				<button class="cu-btn round lines-white" @tap="goHome">返回首页</button>
			</view>
		</view>
		<view class="cu-card card-menu bg-white shadow padding margin card-list radius" style="margin-top: -50rpx;">
			<view class="flex align-center">
				<text class="cuIcon-goods text-theme margin-right-sm" style="font-size: 50rpx;"></text>
				<text class="text-cut text-xl">本次购物已完成！</text>
			</view>
			<view class="margin-top">
				<text class="text-cut text-xx">{{blessing}}</text>
			</view>
		</view>
		<view v-if="productList.length">
			<view class="flex margin-top-sm justify-center">
				<text class="text-cut text-bold text-xl text-grey margin-bottom">———  猜你喜欢  ———</text>
			</view>
			<GoodsCard v-if="productList" :productList="productList" :goodsCategory="goodsCategory" v-model= "productList"></GoodsCard>
		</view>
	</view>
</template>

<script>
	import GoodsCard from "../component/GoodsCard.vue"
	import * as Home_API from '../../api/home.js'
	export default {
		components:{
			GoodsCard
		},
		data() {
			return {
				productList: [],
				blessing:''
			};
		},
		onLoad(){
			this.GET_ProductList(),
			this.randomBlessing()
		},
		methods:{
			GET_ProductList(){
				let shop_id = uni.getStorageSync('shop_id') || 2
				Home_API.HomeGoodsList(shop_id).then(res =>{
					this.productList = res
				})
			},
			goToOrder(){
				uni.redirectTo({
					url:'../order/order'
				})
			},
			goHome(){
				uni.switchTab({
					url:'../home/home'
				})
			},
			randomBlessing(){
				let blessing;
			    let blessings = [
					'今天也是元气满满的一天，祝您购物愉快',
					'小仙女就该对自己好点，祝您购物愉快',
					'今天也要做一个精致的猪猪女孩，祝您购物愉快',
					'艾米妲见证您变美的过程，祝您购物愉快',
				]
			    let ran = Math.floor(Math.random() * blessings.length);
			    blessing = blessings[ran];
			    this.blessing = blessing
			},
		}
	}
</script>

<style lang="scss">

</style>
